package com.simp.controller;

import com.simp.dto.SysLogDto;
import com.simp.entity.SysLogEntity;
import com.simp.page.PageVO;
import com.simp.page.R;
import com.simp.page.SuperController;
import com.simp.service.SysLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author pan.shun
 * @since 2022/3/16 20:19
 */
@Api(tags = "系统日志")
@RestController
@RequestMapping("/log")
public class SysLogController extends SuperController {

    @Autowired
    private SysLogService sysLogService;

    @GetMapping("/list")
    @ApiOperation(notes = "日志分页查询，条件为 > userName=&status= ,其中userName 为用户姓名，status为状态，0、正常 1、异常", value = "日志分页查询", httpMethod = "GET")
    public R<PageVO<SysLogEntity>> getPageList(SysLogDto sysLogDto) {
        return success(sysLogService.getPageList(sysLogDto));
    }

    @ApiOperation(value = "获取主页日志", notes = "获取主页日志", httpMethod = "GET")
    @GetMapping("/getHomeLog")
    public R getHomeLog() {
        return sysLogService.getHomeLog();
    }
}
